Supplied Plug-ins

Help Index

Add/Remove Line Numbers

This plug-in applies or removes line numbers to each line of the text in the active window or in the selection.

Configure TeX Coloring

The Configure TeX Coloring plug-in brings up a dialog box that allows you to choose whether math strings should be colored in TeX documents. (The factory default is for these strings not to be colored.)

Convert to ASCII

Converts all eight-bit Macintosh characters in the active window to their 7-bit ASCII equivalents. This plug-in is useful for preparing text for an email message, or for posting to an information service that doesn't handle 8-bit characters. When selected from the Tools menu, the Convert to ASCII dialog.

Each pair of buttons on the left half of the dialog determines how to convert a particular 8-bit character. The plug-in also converts curly (typographer's) quotes to straight quotes.

The pairs of buttons in the right half of the dialog box determine what action the plug-in takes. You can choose to convert only the selected text (if there is a selection in the active window), and you can choose to place the results on the Clipboard rather than replacing the text in the window.

This plug-in was written by Jamie McCarthy, based on a prototype "Prepare Usenet Posting" plug-in by Rich Siegel.

Note: This plug-in can be used to reverse the effects of the Educate Quotes plug-in.

Educate Quotes

Converts straight quotes to curly (typographer's) quotes in the text of the active window.

Hex Dump

This plug-in provides a hex dump for a file that you choose.

Prefix/Suffix Lines

This plug-in adds or removes a prefix from all the lines of the text of the active window or of the selected text.

Process Duplicate Lines

The Process Duplicate Lines plug-in locates duplicate lines within a body of text and operates on them in some way, as specified in the Process Duplicate Lines dialog.

The Matching All option processes all duplicate lines; Leaving One ignores the first of each set of duplicate lines and processes only the additional ones. If Selected Lines Only is checked, the operation will be limited to the contents of the current selection; if not, it will be applied to the entire document. The options at the bottom of the dialog, beginning with Match Using Pattern, allow you to use a grep pattern to further filter the lines to be processed. Additional options specify that white space at the beginning of lines is to be ignored, that case distinctions are to be taken into account, and that strings of digits are to be evaluated numerically rather than treated simply as lexical strings.

Important: When you use a grep pattern with this plug-in, matches are not automatically anchored to line boundaries, so ambiguous patterns may produce unpredictable results. To avoid this problem, you should use the line start ^ and line end operators as necessary.

You can delete the duplicate lines from the original document (Kill Matches), copy them to the clipboard (Matches on Clipboard) or to a new untitled window (Matches in New Window), or do the same with the lines that are not duplicated (Remainder on Clipboard, Remainder in New Window). Since each of these options is an independent checkbox, you can select any combination of them that you wish. For example, selecting both Kill Matches and Matches on Clipboard would delete the duplicate lines from the document and copy them to the clipboard for pasting elsewhere.

Process Lines Containing

The Process Lines Containing plug-in searches the active window for lines containing a specified search string and then removes those lines or copies them to the clipboard. The options on the left side of the dialog box control how the search is performed and the options on the right side control what happens to the lines that are found.

To specify a search pattern, enter it in the Find Lines Containing text field. To process only the lines in the current selection, select Selected Lines Only. If you don't want TextWrangler to match text when the letters in the text differ from the letters in the search string only by case (upper-case versus lower-case), select Case Sensitive.

To search using a grep pattern, select Use Grep and enter the pattern in the text field. You can also select a predefined search pattern from the Patterns pop-up menu or click the "grab selection" (ยง) button to use the current selection as the search pattern.

Note: If the selection ends in a trailing carriage return, the carriage return will be omitted from the search string copied into the text field.

The checkboxes on the right of the dialog control the way lines containing the specified search pattern will be processed. By selecting the appropriate combinations of these options, you can achieve the effect of applying various editing commands to each line:

The Copy to New Window option opens a new, untitled window containing copies of all lines matching the search pattern, whether or not they're deleted from the original window. You can use this option, together with turning Copy to Clipboard off, to collect all of the matching lines without affecting the previous contents of the clipboard.

The Report Results option tells the plug-in to report the total number of lines matched, regardless of their final disposition. With all of the other options turned off, this can be useful for pretesting the extent of a search operation without affecting the clipboard or the contents of the original window.

Note: The plug-in requires that at least one of these four options be turned on. If you turn off the first three options, the fourth (Report Results) will be turned on automatically.

Sort Lines

This plug-in sorts lines of text by collating them in alphanumeric order. It can operate either on the contents of the current selection or on the whole document. The results can be copied to the clipboard, replace the selection within the original document, be displayed in a new untitled window, or any combination of the three.

There are also options for ignoring white space at the beginning of lines, taking case distinctions into account, sorting strings of digits by numerical value instead of lexically, and sorting in descending rather than ascending order.

By checking the Sort Using Pattern option, you can specify a grep pattern to further filter the lines to be sorted. If the pattern contains subpatterns, you can use them to control the sort order based on the contents of the strings they match.

For example, suppose you are sorting a list of cities together with their two-letter state abbreviations, separated by a tab character. The pattern and subpatterns shown in the figure will sort the results first by city name and second by state abbreviation. Changing the contents of the Specific Sub-Patterns field from "\1\2" to "\2\1" will instead sort the results by state first and by city second.

Un/Comment

This plug-in automates the task of commenting and uncommenting sections of code in various programming languages. Use the companion Un/Comment Settings plug-in to set up the comment strings for the supported languages.

Help Index